<?php

use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix'     => config('admin.route.prefix'),
    'namespace'  => config('admin.route.namespace'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {

    $router->get('/', 'HomeController@index');

    $router->resource('/admin_user_group', 'AdminUserGroupController');

    $router->resource('/auth/users', 'UserController');

    $router->resource('/article', 'UserController');

    $router->resource('/family/fund', 'FamilyFundController');

    $router -> group(
        [
            'prefix' => '/portal',
            'namespace' => 'portal'
        ],
        function (Router $router) {
            $router->resource('/article', 'SwtArticleController');
            $router->resource('/info_disclosure', 'SwtInfoDisclosureController');
            $router->resource('/config', 'SwtPortalConfigController');
            $router->resource('/policy', 'SwtPolicyController');
        }
    );


    $router -> group(
        [
            'prefix' => '/news',
            'namespace' => 'news'
        ],
        function (Router $router) {
            $router->resource('/ad_position', 'AdminAdPositionController');
            $router->resource('/ad', 'AdminAdController');
        }
    );

    $router->any('/upload', 'UploadController@uploadProjectCover');

    $router -> group(
        [
            'prefix' => '/manager',
            'namespace' => 'manager'
        ],
        function (Router $router) {
            $router->any('/create', 'CreateController@index');
            $router->any('/step', 'CreateController@validateStepForm');
            $router->any('/audit', 'AuditController@index');
            $router->resource('/type', 'TypeController');
            $router->resource('/list', 'ListController');
            $router->resource('/flowing', 'FlowingController');
        }
    );

    $router -> group(
        [
            'prefix' => '/education',
            'namespace' => 'education'
        ],
        function (Router $router) {
            $router->any('/create', 'CreateController@index');
            $router->any('/step', 'CreateController@validateStepForm');
            $router->any('/audit', 'AuditController@index');
            $router->resource('/school', 'SchoolController');
            $router->resource('/list', 'ListController');
        }
    );

    $router -> group(
        [
            'prefix' => '/fund',
            'namespace' => 'fund'
        ],
        function (Router $router) {
            $router->any('/create', 'CreateController@index');
            $router->any('/step', 'CreateController@validateStepForm');
            $router->any('/audit', 'AuditController@index');
            $router->resource('/news', 'NewsController');
            $router->resource('/list', 'ListController');
        }
    );

    $router -> group(
        [
            'prefix' => 'region',
        ],
        function (Router $router) {
            $router->any('/cities', 'RegionController@cities');
            $router->any('/districts', 'RegionController@districts');
        }
    );

    $router -> group(
        [
            'prefix' => '/family',
            'namespace' => 'family'
        ],
        function (Router $router) {
            $router->resource('/list', 'ListController');
        }
    );
});
